<?php
/**
 * @author Vuong Minh Chau <mchau2083@yahoo.com>
 */
require_once APPPATH."controllers/cms_template.php";
class cms_store_template extends cms_template{
	function __construct(){
    	parent::__construct();
    	$this->_template_type = 'store';
		$this->load->model('Model_type', 'model_type');
  	}

	function add($level = 1, $nav_id = 0){
		if ($this->input->post('Submit')) {
			// Serialize t1
			$t1 = parse_input("t1_", $_POST);
			$_POST['item_t1'] = serialize($t1);
		 }
		 else{
		 	$types = $this->model_type->fetchAll();
		 	$this->_assign['types'] = $types;
		 }
		 return parent::add($level, $nav_id);
  	}
	/**
	 * 
	 * @param object $level [optional]
	 * @param object $nav_id [optional]
	 * @param object $id [optional]
	 * @return 
	 */
  	function edit($level = 1, $nav_id = 0, $id = 0){
		if ($this->input->post('Submit')) {
			// Serialize t1
			$t1 = parse_input("t1_", $_POST);
			$_POST['item_t1'] = serialize($t1);
		 }
		 else{
		 	$types = $this->model_type->fetchAll();
		 	$this->_assign['types'] = $types;
		 }
		 parent::edit($level, $nav_id, $id);
  	}

}
?>